<div id="menu_categories" class="categories">
    &nbsp;
    <?php 
        $i=0;
        for(; $i< count($categories) && $i<5; $i++)
        {
            $n = $categories[$i];
            ?>
             <a href="/categories/deals/<?=$n->id?>"><?=$n->name?> (<?=$n->number_of_deal?>)</a>
            <?php
        }
    ?>
    <?php if (count($categories) > 5)
    {
        echo '<a id="categories_more" href="javascript:show_sub_menu_categories(this)">More<b class="arrow_down"></b></a>';
    }
    ?>
    
</div>
<div id="sub_menu_categories" class="sub_categories" style="display: none;">
    <?php for(; $i< count($categories); $i++){
            $n = $categories[$i];
        ?>
            <a href="/categories/deals/<?=$n->id?>"><?=$n->name?> (<?=$n->number_of_deal?>)</a><br />
    <?php } ?>
</div>
<script src="<?=base_url()?>js/category.js"></script>